package Java多线程技术;

import Java多线程技术.第1章.MyObject;
import Java多线程技术.第1章.MyThread;

public class Run {
    public static void main(String[] args) throws InterruptedException {
//        MyThread myThread = new MyThread();
//
//        Thread a = new Thread(myThread,"A");
//        Thread b = new Thread(myThread,"B");
//        Thread c = new Thread(myThread,"C");
//        Thread d = new Thread(myThread,"D");
//        Thread e = new Thread(myThread,"E");
//
//        a.start();
//        b.start();
//        c.start();
//        d.start();
//        e.start();


        final MyObject myObject = new MyObject();


        Thread thread1 = new Thread(){
            @Override
            public void run() {
                myObject.setValue("a","aa");
            }
        };
        thread1.setName("a");
        thread1.start();

        Thread.sleep(500);

        Thread thread2 = new Thread(){
            @Override
            public void run() {
                myObject.print();
            }
        };
        thread2.start();
    }
}
